home *** CD-ROM | disk | FTP | other *** search
- class EditorCenterPanMachine extends Library.State
- {
- var oParentMachine;
- var nNumber;
- var mcRef;
- var sState;
- function EditorCenterPanMachine(__mcRef, __oParentMachine)
- {
- super(__mcRef);
- this.oParentMachine = __oParentMachine;
- Main.Instance.doAddListener(this);
- }
- function setNumber(__nNumber)
- {
- this.nNumber = __nNumber;
- this.doChangeNumber();
- this.doSetUpIdle();
- }
- function setRef(__mcRef)
- {
- this.mcRef = __mcRef;
- this.sState = "___RESET___";
- this.setState("Idle");
- }
- function doScrollUp()
- {
- this.setState("Raise");
- }
- function doScrollDown()
- {
- this.setState("Lower");
- }
- function doRefreshVisual()
- {
- this.doLoadStateAction();
- }
- function doDestroy()
- {
- Main.Instance.doRemoveListener(this);
- }
- function doRaise()
- {
- if(this.isStateComplete())
- {
- this.setState("Idle");
- }
- }
- function doLower()
- {
- if(this.isStateComplete())
- {
- this.setState("Idle");
- }
- }
- function doLoadStateAction()
- {
- super.doLoadStateAction();
- switch(this.CurrentState)
- {
- case "Idle":
- this.doSetUpIdle();
- LevelEditor.Instance.onMoveStop();
- break;
- case "Raise":
- this.doSetUpRaise();
- break;
- case "Lower":
- this.doSetUpLower();
- }
- this.doChangeNumber();
- }
- function doChangeNumber()
- {
- var _loc7_ = LevelEditor.Instance.getLinkageFor(this.nNumber);
- var _loc2_ = LevelEditor.Instance.getNumberForPanel(_loc7_);
- var _loc3_ = 0;
- switch(this.CurrentState)
- {
- case "Idle":
- _loc3_ = 0;
- break;
- case "Raise":
- _loc3_ = -1;
- break;
- case "Lower":
- _loc3_ = 1;
- }
- _loc2_ += _loc3_;
- if(_loc2_ > LevelEditor.LETTERS.length - 1)
- {
- _loc2_ = 0;
- }
- else if(_loc2_ < 0)
- {
- _loc2_ = LevelEditor.LETTERS.length - 1;
- }
- var _loc5_ = _loc2_ - 1;
- var _loc6_ = _loc2_;
- var _loc4_ = _loc2_ + 1;
- if(_loc5_ < 0)
- {
- _loc5_ = LevelEditor.LETTERS.length - 1;
- }
- if(_loc4_ > LevelEditor.LETTERS.length - 1)
- {
- _loc4_ = 0;
- }
- var _loc10_ = LevelEditor.LETTERS[_loc5_];
- var _loc9_ = LevelEditor.LETTERS[_loc6_];
- var _loc8_ = LevelEditor.LETTERS[_loc4_];
- this.mcRef.mcState.mcBoxTop.mcNumber.txtNumber.text = _loc10_;
- this.mcRef.mcState.mcBoxCenter.mcNumber.txtNumber.text = _loc9_;
- this.mcRef.mcState.mcBoxBottom.mcNumber.txtNumber.text = _loc8_;
- }
- function doSetUpIdle()
- {
- var _loc2_ = LevelEditor.Instance.getLinkageFor(this.nNumber);
- this.oParentMachine.setVisualForBox(_loc2_,this.mcRef.mcState.mcBoxCenter);
- }
- function doSetUpLower()
- {
- var _loc3_ = LevelEditor.Instance.getLinkageFor(this.nNumber);
- var _loc4_ = LevelEditor.Instance.getNumberForPanel(_loc3_);
- var _loc2_ = _loc4_ + 1;
- if(_loc2_ > LevelEditor.LETTERS.length - 1)
- {
- _loc2_ = 0;
- }
- else if(_loc2_ < 0)
- {
- _loc2_ = LevelEditor.LETTERS.length - 1;
- }
- var _loc5_ = LevelEditor.Instance.getPanelLinkage(_loc2_) + LevelEditor.Instance.getCurrentSuffix();
- this.oParentMachine.setVisualForBox(_loc3_,this.mcRef.mcState.mcBoxTop);
- this.oParentMachine.setVisualForBox(_loc5_,this.mcRef.mcState.mcBoxCenter);
- }
- function doSetUpRaise()
- {
- var _loc3_ = LevelEditor.Instance.getLinkageFor(this.nNumber);
- var _loc4_ = LevelEditor.Instance.getNumberForPanel(_loc3_);
- var _loc2_ = _loc4_ - 1;
- if(_loc2_ > LevelEditor.LETTERS.length - 1)
- {
- _loc2_ = 0;
- }
- else if(_loc2_ < 0)
- {
- _loc2_ = LevelEditor.LETTERS.length - 1;
- }
- var _loc5_ = LevelEditor.Instance.getPanelLinkage(_loc2_) + LevelEditor.Instance.getCurrentSuffix();
- this.oParentMachine.setVisualForBox(_loc3_,this.mcRef.mcState.mcBoxBottom);
- this.oParentMachine.setVisualForBox(_loc5_,this.mcRef.mcState.mcBoxCenter);
- }
- }
-